using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Collections;
using System.Web.UI.WebControls;
using emp.Model;
using emp.IDAL;
using emp.IDAL.SysManage;
using emp.BLL.SysManage;

namespace emp.BLL
{
    public class Item:Tree
    {

        /// <summary>
        /// A method to insert a new Account
        /// </summary>
        /// <param name="account">An account entity with information about the new account</param>
        public void Insert(ItemInfo iinfo)
        {

            // Validate input
            //            if (item.Eng_Item_Name.Trim() == string.Empty)
            //                return;
            // Get an instance of the account DAL using the DALFactory
            IItem dal = DALFactory.Item.Create();

            // Call the DAL to insert the account
            dal.InsertNode(iinfo);
        }

        /// <summary>
        /// A method to update an existing account
        /// </summary>
        /// <param name="account">An account entity with information about the account to be updated</param>
        public void Update(ItemInfo iinfo)
        {

            // Validate input
            //           if (item.LoginName.Trim() == string.Empty)
            //               return;

            // Get an instance of the account DAL using the DALFactory
            IItem dal = DALFactory.Item.Create();

            // Send the udpated account information to the DAL
            dal.ModifyNode(iinfo);
        }

        /// <summary>
        /// A method to update an existing account
        /// </summary>
        /// <param name="account">An account entity with information about the account to be updated</param>
        public void Delete(int iNodeID)
        {

            // Validate input
            //           if (item.LoginName.Trim() == string.Empty)
            //               return;

            // Get an instance of the account DAL using the DALFactory
            IItem dal = DALFactory.Item.Create();

            // Send the udpated account information to the DAL
            dal.DeleteNode(iNodeID);
        }


        public string ConvertItem(int Item_ID)
        {

            // Validate input
            //           if (item.LoginName.Trim() == string.Empty)
            //               return;

            // Get an instance of the account DAL using the DALFactory
            IItem dal = DALFactory.Item.Create();

            // Send the udpated account information to the DAL
            return dal.ConvertItem(Item_ID);
        }

        public int getItemIDByDesc(string item_desc, int parent_item_id)
        {
            IItem dal = DALFactory.Item.Create();
            return dal.getItemIDByDesc(item_desc,parent_item_id);
        }

       
        public IList getChildNodeList(string isdel, int parent_node_id)
        {
            // Get an instance of the account DAL using the DALFactory
            ITree dal = DALFactory.SysManage.Tree.ItemCreate();

            // Send the udpated account information to the DAL
            return dal.getChildNodeList(isdel, parent_node_id);
        }

        public IList getCurrNode(string isdel, int nodeid)
        {
            // Get an instance of the account DAL using the DALFactory
            ITree dal = DALFactory.SysManage.Tree.ItemCreate();

            // Send the udpated account information to the DAL
            return dal.getCurrNode(nodeid);
        }
    }
}
